package com.tql.mall.user.controller;

import com.tql.mall.common.result.R;
import com.tql.mall.model.customer.CustomerRegisterVo;
import com.tql.mall.user.service.CustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "用户信息接口")
@RestController
@RequestMapping("/user/customer")
public class CustomerController {

    @Autowired
    private CustomerService customerService;


    @ApiOperation(value = "用户注册")
    @PostMapping(value = "/register")
    public R<Object> register(@RequestBody CustomerRegisterVo customerRegisterVo){
        String msg = customerService.register(customerRegisterVo);
        if (msg == null) return R.ok();
        return R.fail().msg(msg);

    }
}
